<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link href="{TPL}css/NewTopFoot.css" rel="Stylesheet" type="text/css">
<link type="text/css" rel="stylesheet" href="{TPL}css/AddItemPanel.css">
<link type="text/css" id="styleName" rel="stylesheet" href="{TPL}css/blue/color.css"/ >    

<script type="text/javascript" src="{TPL}js/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="{TPL}js/jQuery.Extend.js"></script>
<script src="{TPL}js/jQuery.Drag.min.js" type="text/javascript"></script>
<script type="text/javascript" src="{TPL}js/jquery.cookies.2.1.0.min.js"></script>
<script src="{TPL}js/Gobal.js" type="text/javascript"></script>
<script type="text/javascript" src="{TPL}js/wdggcGobal.js"></script>
<link type="text/css" rel="stylesheet" href="{TPL}css/changeEmail.css">


    <style type="text/css">
    #ad20100727{z-index:100;display:none;moz-opacity:0.56;opacity: 0.56; filter:alpha(opacity=56); height:40px;background:#fff url({TPL}images/footlayer.jpg) repeat-x 0 0;position:fixed;_position:absolute;bottom:0;border-top:#5BB6D0 solid 2px;left:0;right:0;width:100%;}
.gg_close{width:15px;right:10px;margin:5px 0 -100px 0;background:url({TPL}images/1000912.gif) no-repeat center 2px;height:15px;position:absolute;z-index:100;}
.gg_img{float:left;position:fixed;_position:absolute;bottom:0;background:;z-index:8;width:950px;height:40px;cursor:pointer;}
.gg_img span{height:40px;width:950px;display:block;}
.zd_hf{position:fixed;_position:absolute;margin-left:-475px;left:50%;height:40px;width:950px;bottom:0;z-index:110;display:none;}
    </style><title>{lang m_modify}Email -{lang g_webname}</title></head>

<body>

{template 'header'}
    
    <div class="admin">
        <div class="ding">
            <div class="shouye">
                <a href="{url_m.php}" title="{lang u_member_center}"></a>
            </div>
            <div class="lb">
               <div class="weizhi">
                      <b>{lang m_location}：</b><a href="{url_m.php}">{lang u_member_center}</a><span>&gt;</span>{lang m_modify_email}
                  </div>
                
                <div class="shezhi">
                    <p>
                        <a href="{url_m.php}">{lang u_member_center}</a><span>|</span>{lang m_set_style}：</p>                   <ul>
                        <li onClick="changeStyle('orange')" class="mypanliS1"></li>
                        <li onClick="changeStyle('grey')" class="mypanliS2"></li>
                        <li onClick="changeStyle('blue')" class="mypanliS3"></li>
                    </ul>
                </div>
            </div>
        </div>

{template 'member_left'}  


<form id="aspnetForm" action="m.php?name=changeemail&action=save" method="post" name="aspnetForm">


    <div class="fill">
			<div class="buzhou" style="display:none">
				<img alt="{lang m_modify_email_step_one}" src="{TPL}images/e_1.gif">
				<script type="text/javascript">
				    var p1 = "{lang m_modify_email_input_email}";
				    var p2 = "{lang m_modify_email_input_email}";
				    var p3 = "{lang m_modify_email_confirm_email}";
				    var p4 = "{lang m_modify_email_input_code}";
				   
				    function focusCheck(dom, str) {
				        if ($(dom).val().length > 0)
				            $(dom).attr("class", "").next("p").attr("class", "").html("");
				        else
				            $(dom).attr("class", "").next("p").attr("class", "").html(str);
				    }
				    function CleanTxt(dom, str) {
				        if ($(dom).val().length > 1) {
				            $(dom).attr("class", "").next("p").html("").attr("class", "");
				        }
				       
				    }
				    var emailchecked = false;
				    function IsUsedEmail(dom,email) {
				        $.ajax({
				            type: "POST",
				            url: "/m.php?name=changeemail&action=checkemail",
				            dataType: "json",
				            contentType: "application/json;utf-8",
				            data: "{'email':'" + email.toLowerCase() + "'}",
				            timeout: 10000,
				            error: function(a, b, c) { emailchecked = true; },
				            success: function(msg) {
				            if (msg != "OK") {
				                $(dom).attr("class", "red").next("p").html("{lang m_email_is_exists}").attr("class", "red");
				                    emailchecked = false;
				                }
				                else {
				                    $(dom).attr("class", "").next("p").html("{lang m_email_not_exists}").attr("class", "lv");
				                    emailchecked = true;
				                }
				            }
				        });
				        return emailchecked;
				    }
				    
				    function regEmail(dom) {
				        var email = $.trim($(dom).val());
				        if (email.length > 0) {
				            if (email == "{$value['email']}") {
				                $(dom).attr("class", "red").next("p").html("{lang m_email_new_eq_old}").attr("class", "red"); emailchecked = false;
				            }
				            else if (new RegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*").test(email)) {
				            if (new RegExp("^[A-Za-z-0-9._@]+$").test(email)) {
				                IsUsedEmail(dom, email);
				                if ($("#regEmailTxt").val().length > 0) {
				                    checkRegEmail("#regEmailTxt");
				                }
				                }
				                else
				                    $(dom).attr("class", "red").next("p").html("{lang m_email_instr}").attr("class", "red"); emailchecked = false;
				            }
				            else {
				                $(dom).attr("class", "red").next("p").html("{lang m_email_format_error}").attr("class", "red"); emailchecked = false;
				            }
				        }
				        else {
				            $(dom).attr("class", "").next("p").html(p2).attr("class", ""); emailchecked = false;
				        }
				    }
				    var regEmailchecked = false;
				    function checkRegEmail(dom) {
				        var regEmail = $.trim($(dom).val());
				        if(regEmail.length>0) {
				            if (regEmail == $("#newEmailTxt").val()) {
				                regEmailchecked = true;
				            }
				            else {
				                regEmailchecked = false;
				                $(dom).attr("class", "red").next("p").html("{lang m_confirm_error}").attr("class", "red");
				            }
				        }
				    }
				    var checkcodechecked = false;
				    function checkCode(dom) {
				        var checkCode = $.trim($(dom).val()).toLowerCase();
				        if (checkCode == "") {
				            $(dom).nextAll("p").html("{lang m_modify_email_input_code}"); checkcodechecked = false;
				        }
				        else {
				            $.ajax({
				                type: "GET",
				                url: "m.php?name=changepassword&action=checkcode&code=" + checkCode + "&r=" + new Date(),
				                dataType: "text",
				                timeout: 10000,
				                error: function(a, b, c) { checkcodechecked = true; },
				                success: function(msg) {
				                    if (msg == '0') {
				                        checkcodechecked = false;
				                        $(dom).attr("class", "red").next("p").html("{lang u_verification_error}").attr("class", "red");
				                    }
				                    else {
				                        checkcodechecked = true;
				                        $(dom).attr("class", "").next("p").html("").attr("class", "");
				                    }
				                }
				            });
				        }
				    }
				    function ClearnAll() {
				        if (confirm("{lang m_confirm_reset}")) {
				            $("#passwordTxt").val("").attr("class", "").next("p").attr("class", "").html(p1);
				            $("#newEmailTxt").val("").attr("class", "").next("p").attr("class", "").html(p2);
				            $("#regEmailTxt").val("").attr("class", "").next("p").attr("class", "").html(p3);
				            $("#regCodeTxt").val("").attr("class", "").next("p").attr("class", "").html(p4);
				            $("#regCheckCode").click();
				        }
				    }
				    function CheckForm() {
				        checkCode("#regCodeTxt");
				        var flag = false;
				        if ($.trim($("#passwordTxt").val()).length < 1) {
				            $("#passwordTxt").attr("class", "red").next("p").html("{lang m_modify_email_input_pwd}").attr("class", "red");
				            flag = false;
				        }
				        if ($.trim($("#newEmailTxt").val()).length < 1) {
				            $("#newEmailTxt").attr("class", "red").next("p").html("{lang m_modify_email_input_email}").attr("class", "red");
				            flag = false;
				        }
				        if ($.trim($("#regEmailTxt").val()).length < 1) {
				            $("#regEmailTxt").attr("class", "red").next("p").html("{lang m_modify_email_confirm_email}").attr("class", "red");
				            flag = false;
				        }
				        if ($.trim($("#regCodeTxt").val()).length < 1) {
				            $("#regCodeTxt").attr("class", "red").next("p").html("{lang m_modify_email_input_code}").attr("class", "red");
				            flag = false;
				        }
				        if ($.trim($("#passwordTxt").val()).length > 0 && $.trim($("#newEmailTxt").val()).length > 0 && $.trim($("#regEmailTxt").val()).length > 0 && $.trim($("#regCodeTxt").val()).length > 0) {
				            flag = true;
				        }
				        return flag;
				    }
				    function SubmitForm() {
				        
				        if (CheckForm()) {
				            if (!checkcodechecked) {
				                var checkCode = $.trim($("#regCodeTxt").val()).toLowerCase();
				                if (checkCode == "") {
				                    $(dom).nextAll("p").html("{lang m_modify_email_input_code}"); checkcodechecked = false;
				                }
				                else {
				                    $.ajax({
				                        type: "GET",
				                        url: "/m.php?name=changepassword&action=checkcode&code=" + checkCode + "&r=" + new Date(),
				                        dataType: "text",
				                        timeout: 10000,
				                        error: function(a, b, c) {
				                          
				                        },
				                        success: function(msg) {
				                            if (msg == '0') {
				                                $("#regCodeTxt").attr("class", "red").next("p").html("{lang u_code_error}").attr("class", "red");
				                            }
				                            else {
				                                $("#regCodeTxt").attr("class", "").next("p").html("").attr("class", "");
				                                checkRegEmail("#newEmailTxt");
				                                if (emailchecked && regEmailchecked) {
				                                    $("form")[0].submit();
				                                }
				                            }
				                        }
				                    });
				                }
				            }
				            else {
				                checkRegEmail("#newEmailTxt");
				                if (emailchecked && regEmailchecked) {
				                    $("form")[0].submit();
				                }
				            }
				        }
				    }
				    $(document).ready(function() {
				        $("#regCodeTxt").keydown(function(e) {
				            if (e.keyCode == 13) SubmitForm();
				        })
				        regEmail("#newEmailTxt");
				    });
				</script>

			</div>
<div class="biao">
				<table>
				  <tbody><tr>
					<td class="z">{lang u_email}：</td>
					<td>{$value['email']}</td>
				  </tr>
				  <tr>
					<td class="z">{lang u_confim_recomm}：</td>
					<td><input type="password" value="" onBlur="checkCode('regCodeTxt');focusCheck(this,p1)" onKeyUp="CleanTxt(this,p1)" onFocus="focusCheck(this,p1);checkCode('#regCodeTxt')" maxlength="20" id="passwordTxt" name="passwordTxt">
						<p style="">{lang u_input_pwd_recomm}</p>
					</td>
				  </tr>
				  <tr>
					<td class="z">{lang m_new_email}：</td>
					<td>
						<input type="text" value="" onBlur="checkCode('regCodeTxt');focusCheck(this,p2);regEmail(this);" onKeyUp="CleanTxt(this,p2)" onFocus="focusCheck(this,p2);checkCode('#regCodeTxt')" maxlength="80" id="newEmailTxt" name="newEmailTxt" class="">
						<p class="">{lang m_modify_email_input_email}</p>
					</td>
				  </tr>
				  <tr>
					<td class="z">{lang m_modify_email_confirm_email}：</td>
					<td>
						<input type="text" value="" onBlur="checkCode('regCodeTxt');focusCheck(this,p3);checkRegEmail(this);" onKeyUp="CleanTxt(this,p3)" onFocus="focusCheck(this,p3);checkCode('#regCodeTxt')" maxlength="80" id="regEmailTxt" name="regEmailTxt">
						<p>{lang m_modify_email_confirm_email}</p>
						
					</td>
				  </tr>
				  <tr>
					<td class="z">{lang u_code}：</td>
					<td><input type="text" onBlur="CleanTxt(this,p4);checkCode(this);focusCheck(this,p4)" onKeyUp="CleanTxt(this,p4)" onFocus="focusCheck(this,p4)" maxlength="4" id="regCodeTxt" name="regCodeTxt">
                        <p id="checkCode">{lang m_modify_email_input_code}</p></td>
				  </tr>
				  <tr>
					<td class="z">&nbsp;</td>
					<td><span> <img border="0" onClick="this.src='includes/code/securimage_show.php?sid={echo md5(time())}&amp;t='+Math.random();" style="vertical-align: middle; cursor: pointer;" alt="{lang u_code}" title="{lang u_refresh_code}" src="includes/code/securimage_show.php?sid=<?php echo md5(time()) ?>" id="regCheckCode"></span><a onClick="$('#regCheckCode').click();checkCode('#regCodeTxt')" style="cursor: pointer;">{lang u_new_code}</a></td>
				  </tr>
				</tbody></table>
			</div>
			<div class="tijiao"><input type="button" onClick="SubmitForm()" onMouseOut="this.className=''" onMouseOver="this.className='by'" value="{lang u_confirm_update}" name="commit" class=""><a onClick="ClearnAll()" style="cursor: pointer;">[{lang m_reset}]</a></div>
		</div>


        <div class="yj">
        </div>
    </div>
    
{template 'footer'}

    </form>
</body>
</html>